package Java练习.综合练习;

import java.util.Random;

public class 抢红包 {
    public static void main(String[] args) {
        int[] win={2,588,888,1000,10000};
        //定义新数组用于存储抽奖的结果
        int[] new_win=new int[win.length];
        //抽奖
        Random ra =new Random();
        for (int i = 0; i < win.length;) {
            int celest=ra.nextInt(win.length);
            if (!win_prize(new_win,win[celest])){
                new_win[i]=celest;
                i++;
            }
        }
    }
    //定义方法判断奖品是否已经被抽取了
    public static boolean win_prize(int[] num,int a){

        for (int i = 0; i < num.length; i++) {
            if (num[i]==a){
                return false;
            }
        }
        return true;
    }
}
